import shutil
from spass.core.warehouse import core_w_get_assignment_version
from tempfile import mkdtemp

def create_tmp(id_assignment, id_team, id_version):
    where = mkdtemp(prefix='__spass__', dir='/tmp/')
    if core_w_get_assignment_version(id_assignment, id_team, id_version, where) == 1:
        return 1

    ret = where + '/' + id_assignment + '.' + id_team  + '.' + id_version
    return ret

def delete_tmp(tmp_path):
    shutil.rmtree(tmp_path, True)

